package com.fiberhome.ztelauncher.xml.bean;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

import java.io.Serializable;
import java.util.List;

/**
 * Created by Deed on 2018/3/19.
 */

public class LauncherLayout {
    @XStreamAsAttribute
    public String version;
    @XStreamAlias("PageCommon")
    public PageCommon pageCommon;
    @XStreamAlias("PageList")
    public PageList pageList;

    public static class PageCommon implements Serializable{
        @XStreamAlias("DefaultBackground")
        public String defaultBackground;
        @XStreamAlias("FocusNavBgImg")
        public String focusNavBgImg;
        @XStreamAlias("Margin")
        public Margin margin;
        @XStreamAlias("Spacing")
        public Spacing spacing;
    }

    public static class Margin implements Serializable{
        @XStreamAsAttribute
        public int left;
        @XStreamAsAttribute
        public int top;
        @XStreamAsAttribute
        public int bottom;
        @XStreamAsAttribute
        public int right;
    }

    public static class Spacing implements Serializable{
        @XStreamAsAttribute
        public int width;
        @XStreamAsAttribute
        public int height;
    }

    public static class PageList {
        @XStreamAsAttribute
        @XStreamAlias("MaxPageNumber")
        public int maxPageNumber;

        @XStreamImplicit(itemFieldName = "Page")
        public List<Page> pageList;
    }

    public static class Page implements Serializable{
        @XStreamAsAttribute
        public String id;
        @XStreamAsAttribute
        public int order;
        @XStreamAsAttribute
        public int width;
        @XStreamAsAttribute
        public int height;

        @XStreamAlias("PageName")
        public String pageName;
        @XStreamAlias("PageBackground")
        public String pageBackground;

        @XStreamAlias("PageType")
        public String pageType;

        @XStreamAlias("FontStyle")
        public String fontStyle;

        @XStreamAlias("FontSize")
        public int fontSize;

        @XStreamAlias("FontColor")
        public String fontColor;

        @XStreamAlias("Elements")
        public Elements elements;
    }

    public static class Elements implements Serializable{
        @XStreamImplicit(itemFieldName = "Element")
        public List<Element> elements;
    }

    public static class Element implements Serializable{
        @XStreamAsAttribute
        public String id;
        @XStreamAsAttribute
        public String type;
        @XStreamAsAttribute
        public int left;
        @XStreamAsAttribute
        public int top;
        @XStreamAsAttribute
        public int width;
        @XStreamAsAttribute
        public int height;
    }
}
